Optimal. Leaf size=179 \[ -\frac {1}{8} (2 d-f) \log \left (x^2-x+1\right )+\frac {1}{8} (2 d-f) \log \left (x^2+x+1\right )+\frac {x \left (-\left (x^2 (d-2 f)\right )+d+f\right )}{6 \left (x^4+x^2+1\right )}-\frac {(4 d+f) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {(4 d+f) \tan ^{-1}\left (\frac {2 x+1}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {(2 e-g) \tan ^{-1}\left (\frac {2 x^2+1}{\sqrt {3}}\right )}{3 \sqrt {3}}+\frac {x^2 (2 e-g)+e-2 g}{6 \left (x^4+x^2+1\right )} \]
________________________________________________________________________________________
Rubi [A] time = 0.14, antiderivative size = 179, normalized size of antiderivative = 1.00, number of steps used = 15, number of rules used = 9, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.346, Rules used = {1673, 1178, 1169, 634, 618, 204, 628, 1247, 638} \begin {gather*} \frac {x \left (x^2 (-(d-2 f))+d+f\right )}{6 \left (x^4+x^2+1\right )}-\frac {1}{8} (2 d-f) \log \left (x^2-x+1\right )+\frac {1}{8} (2 d-f) \log \left (x^2+x+1\right )-\frac {(4 d+f) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {(4 d+f) \tan ^{-1}\left (\frac {2 x+1}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {x^2 (2 e-g)+e-2 g}{6 \left (x^4+x^2+1\right )}+\frac {(2 e-g) \tan ^{-1}\left (\frac {2 x^2+1}{\sqrt {3}}\right )}{3 \sqrt {3}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 204
Rule 618
Rule 628
Rule 634
Rule 638
Rule 1169
Rule 1178
Rule 1247
Rule 1673
Rubi steps
\begin {align*} \int \frac {d+e x+f x^2+g x^3}{\left (1+x^2+x^4\right )^2} \, dx &=\int \frac {d+f x^2}{\left (1+x^2+x^4\right )^2} \, dx+\int \frac {x \left (e+g x^2\right )}{\left (1+x^2+x^4\right )^2} \, dx\\ &=\frac {x \left (d+f-(d-2 f) x^2\right )}{6 \left (1+x^2+x^4\right )}+\frac {1}{6} \int \frac {5 d-f+(-d+2 f) x^2}{1+x^2+x^4} \, dx+\frac {1}{2} \operatorname {Subst}\left (\int \frac {e+g x}{\left (1+x+x^2\right )^2} \, dx,x,x^2\right )\\ &=\frac {x \left (d+f-(d-2 f) x^2\right )}{6 \left (1+x^2+x^4\right )}+\frac {e-2 g+(2 e-g) x^2}{6 \left (1+x^2+x^4\right )}+\frac {1}{12} \int \frac {5 d-f-(6 d-3 f) x}{1-x+x^2} \, dx+\frac {1}{12} \int \frac {5 d-f+(6 d-3 f) x}{1+x+x^2} \, dx+\frac {1}{6} (2 e-g) \operatorname {Subst}\left (\int \frac {1}{1+x+x^2} \, dx,x,x^2\right )\\ &=\frac {x \left (d+f-(d-2 f) x^2\right )}{6 \left (1+x^2+x^4\right )}+\frac {e-2 g+(2 e-g) x^2}{6 \left (1+x^2+x^4\right )}+\frac {1}{8} (2 d-f) \int \frac {1+2 x}{1+x+x^2} \, dx+\frac {1}{8} (-2 d+f) \int \frac {-1+2 x}{1-x+x^2} \, dx+\frac {1}{24} (4 d+f) \int \frac {1}{1-x+x^2} \, dx+\frac {1}{24} (4 d+f) \int \frac {1}{1+x+x^2} \, dx+\frac {1}{3} (-2 e+g) \operatorname {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x^2\right )\\ &=\frac {x \left (d+f-(d-2 f) x^2\right )}{6 \left (1+x^2+x^4\right )}+\frac {e-2 g+(2 e-g) x^2}{6 \left (1+x^2+x^4\right )}+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{3 \sqrt {3}}-\frac {1}{8} (2 d-f) \log \left (1-x+x^2\right )+\frac {1}{8} (2 d-f) \log \left (1+x+x^2\right )+\frac {1}{12} (-4 d-f) \operatorname {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac {1}{12} (-4 d-f) \operatorname {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x\right )\\ &=\frac {x \left (d+f-(d-2 f) x^2\right )}{6 \left (1+x^2+x^4\right )}+\frac {e-2 g+(2 e-g) x^2}{6 \left (1+x^2+x^4\right )}-\frac {(4 d+f) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {(4 d+f) \tan ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )}{12 \sqrt {3}}+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{3 \sqrt {3}}-\frac {1}{8} (2 d-f) \log \left (1-x+x^2\right )+\frac {1}{8} (2 d-f) \log \left (1+x+x^2\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.43, size = 200, normalized size = 1.12 \begin {gather*} \frac {1}{36} \left (\frac {6 \left (x \left (-d x^2+d+2 f x^2+f\right )+2 e x^2+e-g \left (x^2+2\right )\right )}{x^4+x^2+1}-\frac {\left (\left (\sqrt {3}-11 i\right ) d-2 \left (\sqrt {3}-2 i\right ) f\right ) \tan ^{-1}\left (\frac {1}{2} \left (\sqrt {3}-i\right ) x\right )}{\sqrt {\frac {1}{6} \left (1+i \sqrt {3}\right )}}-\frac {\left (\left (\sqrt {3}+11 i\right ) d-2 \left (\sqrt {3}+2 i\right ) f\right ) \tan ^{-1}\left (\frac {1}{2} \left (\sqrt {3}+i\right ) x\right )}{\sqrt {\frac {1}{6} \left (1-i \sqrt {3}\right )}}-4 \sqrt {3} (2 e-g) \tan ^{-1}\left (\frac {\sqrt {3}}{2 x^2+1}\right )\right ) \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
IntegrateAlgebraic [F] time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {d+e x+f x^2+g x^3}{\left (1+x^2+x^4\right )^2} \, dx \end {gather*}
Verification is not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 2.03, size = 239, normalized size = 1.34 \begin {gather*} -\frac {12 \, {\left (d - 2 \, f\right )} x^{3} - 12 \, {\left (2 \, e - g\right )} x^{2} - 2 \, \sqrt {3} {\left ({\left (4 \, d - 8 \, e + f + 4 \, g\right )} x^{4} + {\left (4 \, d - 8 \, e + f + 4 \, g\right )} x^{2} + 4 \, d - 8 \, e + f + 4 \, g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) - 2 \, \sqrt {3} {\left ({\left (4 \, d + 8 \, e + f - 4 \, g\right )} x^{4} + {\left (4 \, d + 8 \, e + f - 4 \, g\right )} x^{2} + 4 \, d + 8 \, e + f - 4 \, g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) - 12 \, {\left (d + f\right )} x - 9 \, {\left ({\left (2 \, d - f\right )} x^{4} + {\left (2 \, d - f\right )} x^{2} + 2 \, d - f\right )} \log \left (x^{2} + x + 1\right ) + 9 \, {\left ({\left (2 \, d - f\right )} x^{4} + {\left (2 \, d - f\right )} x^{2} + 2 \, d - f\right )} \log \left (x^{2} - x + 1\right ) - 12 \, e + 24 \, g}{72 \, {\left (x^{4} + x^{2} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.31, size = 142, normalized size = 0.79 \begin {gather*} \frac {1}{36} \, \sqrt {3} {\left (4 \, d + f + 4 \, g - 8 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{36} \, \sqrt {3} {\left (4 \, d + f - 4 \, g + 8 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + \frac {1}{8} \, {\left (2 \, d - f\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{8} \, {\left (2 \, d - f\right )} \log \left (x^{2} - x + 1\right ) - \frac {d x^{3} - 2 \, f x^{3} + g x^{2} - 2 \, x^{2} e - d x - f x + 2 \, g - e}{6 \, {\left (x^{4} + x^{2} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 260, normalized size = 1.45 \begin {gather*} \frac {\sqrt {3}\, d \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right )}{9}+\frac {\sqrt {3}\, d \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{9}-\frac {d \ln \left (x^{2}-x +1\right )}{4}+\frac {d \ln \left (x^{2}+x +1\right )}{4}-\frac {2 \sqrt {3}\, e \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right )}{9}+\frac {2 \sqrt {3}\, e \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{9}+\frac {\sqrt {3}\, f \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right )}{36}+\frac {\sqrt {3}\, f \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{36}+\frac {f \ln \left (x^{2}-x +1\right )}{8}-\frac {f \ln \left (x^{2}+x +1\right )}{8}+\frac {\sqrt {3}\, g \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right )}{9}-\frac {\sqrt {3}\, g \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{9}+\frac {-\frac {2 d}{3}+\frac {e}{3}+\frac {f}{3}-\frac {2 g}{3}+\left (-\frac {d}{3}-\frac {e}{3}+\frac {2 f}{3}-\frac {g}{3}\right ) x}{4 x^{2}+4 x +4}-\frac {-\frac {2 d}{3}-\frac {e}{3}+\frac {f}{3}+\frac {2 g}{3}+\left (\frac {d}{3}-\frac {e}{3}-\frac {2 f}{3}-\frac {g}{3}\right ) x}{4 \left (x^{2}-x +1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 2.58, size = 135, normalized size = 0.75 \begin {gather*} \frac {1}{36} \, \sqrt {3} {\left (4 \, d - 8 \, e + f + 4 \, g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{36} \, \sqrt {3} {\left (4 \, d + 8 \, e + f - 4 \, g\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + \frac {1}{8} \, {\left (2 \, d - f\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{8} \, {\left (2 \, d - f\right )} \log \left (x^{2} - x + 1\right ) - \frac {{\left (d - 2 \, f\right )} x^{3} - {\left (2 \, e - g\right )} x^{2} - {\left (d + f\right )} x - e + 2 \, g}{6 \, {\left (x^{4} + x^{2} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.15, size = 237, normalized size = 1.32 \begin {gather*} \frac {\left (\frac {f}{3}-\frac {d}{6}\right )\,x^3+\left (\frac {e}{3}-\frac {g}{6}\right )\,x^2+\left (\frac {d}{6}+\frac {f}{6}\right )\,x+\frac {e}{6}-\frac {g}{3}}{x^4+x^2+1}-\ln \left (x-\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {d}{4}-\frac {f}{8}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{18}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{9}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{72}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{18}\right )-\ln \left (x+\frac {1}{2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {f}{8}-\frac {d}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{18}-\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{9}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{72}+\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{18}\right )+\ln \left (x-\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {f}{8}-\frac {d}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{18}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{9}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{72}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{18}\right )+\ln \left (x+\frac {1}{2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{2}\right )\,\left (\frac {d}{4}-\frac {f}{8}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{18}-\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{9}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{72}+\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{18}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________